var index = index || {};


$(function () {

    $("#cs").click(function () {
        index.list();
    });

    $("#logout").click(function () {
        index.logout();
    });

    $("#test").click(function () {
        index.test();
    });

});

index.list = function () {
    $.ajax({
        type: 'POST',
        url: 'http://127.0.0.1:8889/api/v1.1/person/',
        data: '',
        success: function (data) {
            if (data.code == 200) {
                $("#data").html(data.attach);
            }
        }
    })
};
index.logout = function () {
    $.ajax({
        type: 'GET',
        url: 'http://127.0.0.1:8889/logout',
        data: '',
        success: function (data) {
            if (data.code == 200) {
                window.location.href = "http://127.0.0.1:8890/login";
            }
        }
    })
};
index.test = function () {
    $.ajax({
        type: 'GET',
        url: 'http://127.0.0.1:8889/public/test',
        data: '',
        success: function (data) {
            if (data.code == 200) {
                alert("测试成功")
            }
        }
    })
};

